﻿using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SqliteTest1
{

    public class SQLiteCommandWrapper : IDisposable
    {
        private readonly SQLiteConnection _connection;
        private readonly SQLiteCommand _command;

        public SQLiteCommandWrapper(string connectionString, string commandText)
        {
            _connection = new SQLiteConnection(connectionString);
            _connection.Open();
            _command = new SQLiteCommand(commandText, _connection);
        }

        public SQLiteCommand Command => _command;

        public void Dispose()
        {
            _command?.Dispose();
            _connection?.Close();
            _connection?.Dispose();
        }
    }
}
